Dictionary Case (Typography)
Dictionaries provide extensive functionality to enable entry recognition to be conditioned on the case of the observed text. Case sensitivity is provided via a case condition:
#cond:case [-][lower] [-][upper] [-][exact] [-][title]
where the case conditions are:
- lower - matches only the lower case form of the entry text (for example, "Big" will match "big" only)
- upper - matches only the upper case form of the entry text (for example, "Big" will match "BIG" only)
- exact - matches only the exact case of the entry text (for example, "BIg" will match "BIg" only)
- title - conditions depend on whether the entry text is a single word or a phrase
- single word - matches only the capitalized form of the entry text (for example, "big" will match "Big" only)
- phrases - match entire phrase if at least one of the words is capitalized (for example, "big blue bird" will match "Big blue bird", "big Blue bird","big blue Bird" and "Big blue Bird")
If a case condition is not specified, the entry text will match the same text in any case.
For lower and upper, the typography in the entry text has no significance.
However, the entry text is significant for the case conditions exact and title.
Several case conditions can be use at once; for example:
#cond:case lower title
Case conditions can be excluded. Exclusion can be combined with inclusion. Exclusion takes precedence over inclusion.
#cond: -upper
TITLE case matching
For the purpose of matching in Dictionaries, the case of a word falls into the following hierarchy:
lower < capitalized < higher
and
other < higher
where other
is any case not equal to lower
or capitalized.
Examples of other
include mixed case (for example, eXamPle) and camel case (for example, exaMple).
For single words, the title
case condition will match capitalized versions of the entry text. The capitalized form cannot be fully uppercase and must have at least one lowercase character for there to be a match.
Examples:
queen -> matches Queen but not QUEEN
Queen -> matches Queen but not QUEEN
QuEen -> matches QuEen but not QUEen
quEen -> no match
For phrases, the title
case condition will match the entire phrase if at least one of the words is capitalized, even if the capitalized word is fully uppercase. The exception to this is when capitalization is defined for a given word in the entry text. For example, if the entry text is "queen of Hearts", the word "Hearts" must either be capitalized (Hearts) or fully upper case (HEARTS) to meet the matching conditions.
If the entire phrase is uppercase, there will not be a match.
Examples:
queen of hearts -> matches Queen of hearts, QUEEN of hearts, queen of HEARTS... but not QUEEN OF HEARTS
Queen of Hearts -> matches QUEEN of HEARTS, QUEEN Of HEARTS, Queen of HEARTS... but not QUEEN OF HEARTS or QuEeN of Hearts
Further examples
[To be found with the example Dictionaries distributed with Sintelix]
/*
#EXAMPLE
matching: anything, Anything, aNyThing, low, little'1, lower case, UPPER-CASE, FireFox, Water SA
not-matching: Low, upper-CASE, fireFox, water sa
Queen of Hearts - YES.
Queen Of Hearts - YES.
QueeN of Hearts - NO.
QUEEN OF HEARTS - NO.
THE Hitchhiker's Guide To The Galaxy - YES.
The Mcguffey Readers - NO.
The MCGUFFEY Readers - YES.
#EXAMPLE END
*/
#wordlist Demo3-Case-any
anything // applies to Anything, aNyThing, ...
// "lower" case condition matches only text written in lowercase
#wordlist Demo3-Case-lower
#cond:case lower
lowercase
Low
// case-sensitivity applies to word but not numbers and symbols,
// only the word "little" in "little'1" is required to be lowercase
little'1
// case-sensitivity applies to phrases as well
lower case
// "upper" case condition acts similarly to "lower"
#wordlist Demo3-Case-upper
#cond:case upper
upper-case
#wordlist Demo3-Case-exact
#cond:case exact
FireFox // matches only FireFox, not firefox, fireFox, ...
Water SA // same goes for phrases
#wordlist Demo3-Case-title
#cond:case title
Queen of Hearts
The Hitchhiker's Guide to the Galaxy
The McGuffey Readers
#wordlist Demo3-Case-title-or-upper
// To also match upper and/or lower case, you may add alternatives to cond:case
#cond:case title upper
Queen of Heart // note the difference comparing to wordlist:Demo3-Case-title
#wordlist Demo3-Case-not-lower
#cond:case -lower
anything // any form except lowercase
Giving the results: